<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<script type="text/javascript" src="js/jquery-1.12.4.js"></script>
	<script type="text/javascript">
		$(function(){
			$("th").css("background","#ff000066");
		})
		function testing() {
			if ($("#empName").val()=="") {
				alert("姓名不能为空");
				return false;
			}
			if ($("#dept").val()=="") {
				alert("部门不能为空");
				return false;
			}
			if ($("#chkDate").val()=="") {
				alert("考勤日期不能为空");
				return false;
			}
			if ($("select").val()==0) {
				alert("考勤状况不能为空");
				return false;
			}
			var timeRegex1 = /^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/;
			if (!timeRegex1.test($("#chkDate").val())) {
				alert("日期格式为yyyy-MM-dd");
				return false;
			}
			return true;
		}
	</script>
	<div align="center">
		<form action="AttenceAddServlet" method="post" onsubmit="testing()">
			<table border="1" align="center">
				<tr>
					<th colspan="5">添加考勤记录信息</th>
				</tr>
				<tr>
					<td align="center">姓名</td>
					<td><input type="text" name="empName" id="empName" ></td>
				</tr>
				<tr>
					<td align="center">所属部门</td>
					<td><input type="text" name="dept" id="dept"></td>
				</tr>
				<tr>
					<td align="center">考勤日期</td>
					<td><input type="text" name="chkDate" id="chkDate">日期格式:yyyy-MM-dd</td>
				</tr>
				<tr>
					<td align="center">考勤状态</td>
					<td><select name="status">
							<option value='0'>请选择考勤类型</option>
							<option value='正常'>正常</option>
							<option value='迟到'>迟到</option>
							<option value='早退'>早退</option>
							<option value='休假'>休假</option>
							<option value='外出'>外出</option>
					</select></td>
				</tr>
				<tr>
					<td style="text-align: center;" colspan="2"><input
						type="submit" value="登记"></td>
				</tr>
			</table>
		</form>
	</div>
</body>
</html>